package com.bst.system.service.impl;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

import java.io.IOException;
import java.util.Date;

public class SysWeatherServiceImpl {

    public static void main2(String[] args) throws IOException {
        OkHttpClient client = new OkHttpClient().newBuilder()
                .build();
        Request request = new Request.Builder()
                .url("https://j.i8tq.com/weather2020/search/city.js")
                .method("GET", null)
                .addHeader("Referer", "http://www.weather.com.cn/")
                .build();
        Response response = client.newCall(request).execute();
        System.out.println(response.body().string());
    }

    public static void main(String[] args) throws IOException {

        OkHttpClient client = new OkHttpClient().newBuilder()
                .build();
        Request request = new Request.Builder()
                .url("http://d1.weather.com.cn/sk_2d/101280606.html?_="+new Date().getTime())
                .method("GET", null)
                .addHeader("Referer", "http://www.weather.com.cn/")
                .build();
        Response response = client.newCall(request).execute();
        System.out.println(response.body().string());
    }
}
